/*
 * @Author: 张久冬
 * @Date: 2022-01-06 15:40:11
 * @
# Description:
 */
import * as echarts from 'echarts'
import { EChartsOption } from 'echarts'
export default function (ele: HTMLElement) {
  const echartsInstance = echarts.init(ele)
  const setOptions = (options: EChartsOption) => {
    echartsInstance.setOption(options)
  }
  const updateSize = () => {
    echartsInstance.resize()
  }
  window.addEventListener('resize', () => {
    echartsInstance.resize()
  })
  return {
    echartsInstance,
    setOptions,
    updateSize
  }
}
